#import "ImageAndTextCell.h"
#import <AppKit/NSCell.h>
#import "PSFileListNode.h"


@implementation ImageAndTextCell

@synthesize removeButton = _removeButton;
@synthesize nameText = _nameText;
@synthesize detailText = _detailText;
@synthesize progress = _progress;


- (void) awakeFromNib
{
    [super awakeFromNib];
    [_removeButton setTransparent:YES];
    [_removeButton setEnabled:NO];
    
    [[self window] setAcceptsMouseMovedEvents:YES];
    NSTrackingArea *trackingArea = [[[NSTrackingArea alloc] initWithRect:[self visibleRect]
																 options:NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingInVisibleRect|NSTrackingActiveAlways |NSTrackingActiveAlways
																   owner:self
																userInfo:nil] autorelease];
	
	[self addTrackingArea:trackingArea];
}

- (void)dealloc {
    [_nameText release], _nameText = nil;
    [_detailText release], _detailText = nil;
    [_progress release], _progress = nil;
    [_removeButton release], _removeButton = nil;
    
    [super dealloc];
}


- (void)mouseEntered:(NSEvent *)event
{
    [_removeButton setTransparent:NO];
    [_removeButton setEnabled:YES];
}


- (void)mouseExited:(NSEvent *)event
{
    [_removeButton setTransparent:YES];
    [_removeButton setEnabled:NO];
}

- (void)mouseMoved:(NSEvent *)theEvent
{
    [_removeButton setTransparent:NO];
    [_removeButton setEnabled:YES];
}

- (void)mouseDragged:(NSEvent *)theEvent
{
    [_removeButton setTransparent:YES];
    [_removeButton setEnabled:NO];
}


@end

